import os 
os.system('docker rm -f $(docker ps -aq)')
os.system('docker rmi restfulapp:latest')
os.system('docker rmi streamlitapp:latest')
base_path = os.getcwd()
restful_path = os.path.join(base_path,'restful')
app_path = os.path.join(restful_path,'app')
os.chdir(restful_path)
os.system('docker build -f dockerfile-restfulapp -t restfulapp .')
os.system(f'docker run -itd -p 8000:8000 -v {app_path}:/app --name restfulapp --net mynet restfulapp')
streamlit_path = os.path.join(base_path,'streamlit')
os.chdir(streamlit_path)
app_path = os.path.join(streamlit_path,'app')
os.system('docker build -f dockerfile-streamlit -t streamlitapp .')
os.system(f'docker run -itd -p 8501:8501 -v {app_path}:/app --name streamlitapp --net mynet streamlitapp')